package com.yiduo.outpost.core.model.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

import java.util.Collection;
import java.util.Collections;

public enum UserRole implements IEnum<Integer> {

    /**
     * 管理员
     */
    ROLE_ADMIN,

    /**
     * 员工
     */
    ROLE_EMPLOYEE;

    public Collection<SimpleGrantedAuthority> getAuthorities() {
        return Collections.singletonList(new SimpleGrantedAuthority(name()));
    }

    @Override
    public Integer getValue() {
        return ordinal();
    }
}